if(MSVC)
    set(CMAKE_CXX_FLAGS "/EHsc /wd\"4819\" /wd\"4996\"")  

    if(ZPSOE_BUILD_STATIC_LIB)
        set(CMAKE_CXX_FLAGS_DEBUG "/MTd")
        set(CMAKE_CXX_FLAGS_MINSIZEREL "/MT")
        set(CMAKE_CXX_FLAGS_RELEASE "/MT")
        set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT")
    endif()
    
    set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} /Zi /Ob0 /Od /RTC1")
    set(CMAKE_CXX_FLAGS_MINSIZEREL     "${CMAKE_CXX_FLAGS_MINSIZEREL} /O1 /Ob1 /D NDEBUG")
    set(CMAKE_CXX_FLAGS_RELEASE        "${CMAKE_CXX_FLAGS_RELEASE} /O2 /Ob2 /D NDEBUG")
    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Zi /O2 /Ob1 /D NDEBUG")
endif()

if(CMAKE_COMPILER_IS_GNUCXX)
    set(CMAKE_CXX_FLAGS_RELEASE "-s -O3 -Os")
    set(CMAKE_CXX_FLAGS_DEBUG  "-O0 -g -ggdb")
    set(CMAKE_CXX_FLAGS
        "-Wall -Wno-unused-variable -Wno-reorder -Wno-unused-function -Wno-unused-local-typedefs")
endif()